define(["jquery", "easy-admin", "vue"], function ($, ea, Vue) {

    var form = layui.form
        ,upload = layui.upload;

    var Controller = {
        index: function () {
            upload.render({
                elem: '#uploadCert'
                ,accept:'file'
                ,exts:'pem'
                ,acceptMime:'file/*'
                ,field:'pem'
                ,url: '/admin/weixin.config/uploadPem' //此处用的是第三方的 http 请求演示，实际使用时改成您自己的上传接口即可。
                ,done: function(res){
                    if(res.code == 1){
                        layer.msg('上传成功',{icon:6,shade:0.5});
                        $('#uploadCert').addClass('layui-hide');
                        $('#uploadCert').html('<input type="hidden" name="wx_pay_cert" value="'+res.data.url+'">');
                        $('#uploadDemoView').removeClass('layui-hide');
                    }else{
                        layer.msg(res.msg,{icon:5,shade:0.5})
                    }
                }
            });
            upload.render({
                elem: '#uploadCertKey'
                ,accept:'file'
                ,exts:'pem'
                ,acceptMime:'file/*'
                ,field:'pem'
                ,url: '/admin/weixin.config/uploadPem' //此处用的是第三方的 http 请求演示，实际使用时改成您自己的上传接口即可。
                ,done: function(res){
                    if(res.code == 1){
                        layer.msg('上传成功',{icon:6,shade:0.5});
                        $('#uploadCertKey').addClass('layui-hide');
                        $('#uploadCertKey').html('<input type="hidden" name="wx_pay_cert_key" value="'+res.data.url+'">');
                        $('#uploadDemoViewKey').removeClass('layui-hide');
                    }else{
                        layer.msg(res.msg,{icon:5,shade:0.5})
                    }
                }
            });

            ea.listen();
        }
    };
    return Controller;
});